package com.huqing.icu.exceptions;

import com.huqing.icu.enums.BusinessConstants;
import com.huqing.icu.protocol.SystemResponseCode;

public class BusinessException extends SystemException {


    private int code;

    private String msg;

    public BusinessException() {
        super("系统内部错误");
        this.code = SystemResponseCode.INTERNAL_ERROR.getCode();
    }

    public BusinessException(SystemResponseCode responseCode) {
        super(responseCode.getMsg());
        this.code = responseCode.getCode();
    }

    public BusinessException(BusinessConstants constants) {
        super(constants.getMsg());
        this.code = constants.getCode();
        this.msg = constants.getMsg();
    }

    public BusinessException(int code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public BusinessException(int errorCode, String message, Object... args) {
        super(String.format(message, args));
        this.code = errorCode;
    }

    public int getErrorCode() {
        return code;
    }

    public void setErrorCode(int errorCode) {
        this.code = errorCode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getErrorTitle() {
        return null;
    }

    public String getErrorDescription() {
        return null;
    }
}
